package com.mar.rover;

public class Rover {
	private int pointX;
	private int pointY;
	private String direction;
	
	public Rover(int pointX, int pointY, String direction) {
		this.pointX = pointX;
		this.pointY = pointY;
		this.direction = direction;
	}

	public void turnLeft() {
		if("E".equals(this.direction))
		{
			 this.direction = "N";
		}
		else if("S".equals(this.direction))
		{
			this.direction = "E";
		}
		else if("W".equals(this.direction))
		{
			this.direction = "S";
		}
		else if("N".equals(this.direction))
		{
			this.direction = "W";
		}
	}

	public String reportCurrentStatus() {
		return ""+this.pointX+" "+this.pointY+" " + this.direction;
	}

	public void turnRight() {
		if("E".equals(this.direction))
		{
			this.direction = "S";
		}
		else if("S".equals(this.direction))
		{
			this.direction = "W";
		}
		else if("W".equals(this.direction))
		{
			this.direction = "N";
		}
		else if("N".equals(this.direction))
		{
			this.direction = "E";
		}
	}

	public void move() {
		if("E".equals(this.direction))
		{
			this.pointX = this.pointX + 1;
		}
		else if("S".equals(this.direction))
		{
			this.pointY = this.pointY - 1;
		}
		else if("W".equals(this.direction))
		{
			this.pointX = this.pointX - 1;
		}
		else if("N".equals(this.direction))
		{
			this.pointY = this.pointY + 1;
		}
	}
}
